<template>
  <div>
    <div v-for="item in menu">
      <!--如果有子菜单-->
      <div v-if="item.children">
        <el-submenu :index="item.index" style="width: 200px">
          <!--标题-->
          <template slot="title">
            <i :class="item.icon"></i>
            <span>{{item.title}}</span>
          </template>
          <!--递归子菜单-->
          <Menu :menu="item.children"></Menu>
        </el-submenu>
      </div>
      <div v-else>
        <el-menu-item :index="item.url" style="width: 200px">
          <i :class="item.icon"></i>
          <span slot="title">{{item.title}}</span>
        </el-menu-item>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "Menu",
    props: ['menu']

  }
</script>

<style scoped>

</style>
